<template>

    <div class="container">
        <!--左侧  -->
        <div class="left">
            <span class="lBtn" @click="goBack">首页</span>
        </div>
        <!-- 中间 -->
        <div class="center">
            <div class="title">AAS报警可视化大数据平台</div>
        </div>
        <!-- 右侧 -->
        <div class="right">
            <span class="rBtn">统计报告</span>
            <span class="title">当前时间:{{ currTime }}</span>
        </div>
    </div>

</template>
<script setup lang='ts'>
/**
 * description 可视化大屏顶部
 * author rz
 * date 2024-08-04
 */
import { ref, onMounted, onBeforeMount } from 'vue'
// import moment from 'moment';
import { useRouter } from 'vue-router'
// let currTime = ref(moment().format("YYYY年MM月DD日 hh:mm:ss"));
let currTime = ref("2024年8月24日 16:20:35");
let refreshTime = ref();
let $router = useRouter();

onMounted(() => {
    // 刷新时间
    // refreshTime.value = setInterval(() => {
    //     currTime.value = moment().format("YYYY年MM月DD日 hh:mm:ss");
    // }, 1000)
})

onBeforeMount(() => {
    // 清除定时器
    clearInterval(refreshTime.value);
    refreshTime.value = null;
})

// 返回首页
const goBack = () => {
    $router.push('/home');
}

</script>
<style scoped lang="scss">
.container {
    width: 100%;
    height: 100%;
    display: flex;

    .left {
        flex: 1;
        background: url("/src/assets/screen/dataScreen-header-left-bg.png") no-repeat;
        background-size: 100% 100%;

        .lBtn {
            float: right;
            width: 150px;
            height: 40px;
            line-height: 40px;
            cursor: pointer;
            background: url("/src/assets/screen/dataScreen-header-btn-bg-l.png") no-repeat;
            background-size: 100% 100%;
            color: #29fcff;
            text-align: center;
        }
    }

    .center {
        flex: 2;

        .title {
            width: 100%;
            height: 74px;
            text-align: center;
            background: url("/src/assets/screen/dataScreen-header-center-bg.png") no-repeat;
            background-size: 100% 100%;
            color: #29fcff;
            font-size: 30px;
            line-height: 74px;
        }
    }

    .right {
        flex: 1;
        display: flex;
        justify-content: space-between;
        align-items: center;
        background: url("/src/assets/screen/dataScreen-header-right-bg.png") no-repeat;
        background-size: 100% 100%;

        .rBtn {
            width: 150px;
            height: 40px;
            text-align: center;
            line-height: 40px;
            color: #29fcff;
            background: url("/src/assets/screen/dataScreen-header-btn-bg-r.png") no-repeat;
        }

        .title {
            color: #29fcff;
            margin-right: 30px;
        }
    }

}
</style>